#include "Scene12.hpp"

Scene12::Scene12() {
    this->roomDepth = 8.0f;

    b2Vec2 vertices[8];
    vertices[0].Set(-10.55f, -6.0f);
    vertices[1].Set(10.55f, -6.0f);
    vertices[2].Set(10.55f, -4.0f);
    vertices[3].Set(8.55f, -4.0f);
    vertices[4].Set(8.55f, 6.0f);
    vertices[5].Set(-8.55f, 6.0f);
    vertices[6].Set(-8.55f, -4.0f);
    vertices[7].Set(-10.55f, -4.0f);

    this->createRoom(12, vertices, 8);

    b2Vec2 platformVertices[4];
    platformVertices[0].Set(-4.55f, 3.5f);
    platformVertices[1].Set(-4.55f, 2.0f);
    platformVertices[2].Set(1.65f, 2.0f);
    platformVertices[3].Set(1.65f, 3.5f);

    this->createPlatform(platformVertices, 4);

    b2Vec2 platformVertices2[2];
    platformVertices2[0].Set(5.05f, 2.0f);
    platformVertices2[1].Set(8.55f, 6.0f);

    this->createPlatform(platformVertices2, 2);

    b2Vec2 platformVertices3[3];
    platformVertices3[0].Set(-2.85f, -3.5f);
    platformVertices3[1].Set(-2.85f, -4.0f);
    platformVertices3[2].Set(-0.5f, -4.0f);

    this->createPlatform(platformVertices3, 3);

    this->start = this->createDoor(-8.55f, -5.0f, -1.0f);
    this->createExit(9.55f, -5.0f);
    this->hero = this->createHero(-10.55f + HeroElement::WIDTH / 2.0f, -6.0f + HeroElement::HEIGHT / 2.0f);

    // Hero jump.
    this->createFlash(-8.55f, -3.15f, -b2_pi / 2.0f, b2Vec2(1000.0f, 600.0f));
    this->createFlash(8.55f, -1.0f, b2_pi / 2.0f, b2Vec2(-1500.0f, 400.0f));
    this->createFlash(-8.55f, 0.0f, -b2_pi / 2.0f, b2Vec2(415.0f, 800.0f));

    // First door.
    DoorElement* firstDoor = this->createDoor(5.05f, 3.0f, 0.0f);
    this->createSwitch(-3.7f, 2.0f, 0.0f, firstDoor);

    // Repulsive light.
    this->createBox(-1.35f, 2.5f);
    this->createFlash(0.15f, 2.0f, 0.0f, b2Vec2(200.0f, 200.0f));
    this->createFlash(2.0f, -6.0f, 0.0f, b2Vec2(-50.0f, 150.0f));
    SpotlightElement* light = this->createSpotlight(-7.05f, -1.5f, b2_pi / 3.7f, b2_pi / 6.0f, 13.0f, LightElement::repulsiveLight);
    this->createSwitch(-1.675f, -4.0f, 0.0f, light);

    // Exit door.
    this->exit = this->createDoor(8.55f, -5.0f, 1.0f);
    this->createSwitch(5.55f, -6.0f, 0.0f, this->exit);
}
